<template>
  <div class="userInfo">
    <el-card shadow="hover" class="box-card">
      <h2>用户信息</h2>
      <p> 欢迎您， {{ userInfo.username }}</p>
      <p> {{ userInfo.mobile }}</p>
      <p> {{ userInfo.email }}</p>
      <el-button type="info" plain @click="logout">
        注销登陆
      </el-button>
    </el-card>
  </div>
</template>

<script>
import { mapGetters, mapState } from 'vuex'
export default {
  props: {
    formType: String
  },
  computed: {
    ...mapState('user', ['userInfo'])
  },
  data() {
    return {

    }
  },
  methods: {
    logout() {
      this.$emit('update:formType', 'LoginForm')
      window.sessionStorage.removeItem('userInfo');
      this.$message('注销登陆成功！')
      return this.$router.push({ name: 'Login'})
    }
  }
}
</script>

<style>

</style>